package com.jy.datapipeline.importserver.mapper;

import com.jy.datapipeline.importserver.entity.ImportTask;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Set;

public interface ImportTaskMapper {
    int deleteByPrimaryKey(Long id);

    int insert(ImportTask record);

    int insertSelective(ImportTask record);

    ImportTask selectByPrimaryKey(Long id);

    int updateByPrimaryKeySelective(ImportTask record);

    int updateByPrimaryKey(ImportTask record);

    List<ImportTask> selectByPage(@Param("pageNo") Long pageNo, @Param("pageSize") Long pageSize, @Param("taskId") String taskId
            , @Param("taskType") String taskType, @Param("taskStatus") String taskStatus
            , @Param("targetDataSourceId") String targetDataSourceId, @Param("storeId") String storeId
            , @Param("ruleId") String ruleId, @Param("trySubtaskLoadCount") Integer trySubtaskLoadCount);

    Long selectTotalSize(@Param("taskId") String taskId
            , @Param("taskType") String taskType, @Param("taskStatus") String taskStatus
            , @Param("targetDataSourceId") String targetDataSourceId, @Param("storeId") String storeId
            , @Param("ruleId") String ruleId, @Param("trySubtaskLoadCount") Integer trySubtaskLoadCount, @Param("latestStatus") String latestStatus);

    ImportTask selectDetailsById(Long id);

    Long lockResources(@Param("ids") Long[] ids);

    Long deleteByIds(@Param("ids") Long[] ids);

    Set<String> selectTaskIds(@Param("ids") Long[] ids);

    ImportTask selectByTaskId(String taskId);

    int updateTaskByTaskId(ImportTask importTask);

    List<ImportTask> selectNames(String taskName);

    List<ImportTask> selectImportTasks(@Param("ids") Long[] ids);

    Set<Long> selectIdsByRuleId(String ruleId);

    Long selectResources(@Param("ids") Long[] ids);

    Integer selectSameName(@Param("taskName") String taskName, @Param("ids") Long... id);

    int updateLatestStatus(ImportTask importTask);

    int batchInsert(@Param("importTasks") List<ImportTask> importTasks);
}